<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html>
  <head> 
    <title>指标评估与模型设置</title>  
    <jsp:include page="/include.jsp"/>
    <script type="text/javascript">
   

        
    //新增
    function doAdd(){     
    	window.top.$('<div/>').dialog({
			href:'${pageContext.request.contextPath}/dqm/mininganalysis/dataestimatecal/dataestimatecal_add.jsp',
			top:($(window.top).height()-250)*0.5,
		    left:($(window.top).width()-250)*0.5,
			width:660,
			modal:true,
			title:'新增指标评估',
			buttons : [ {
				text : '保存',
				iconCls : 'icon-add',
				handler : function() {
					var d = window.top.$(this).closest('.window-body');
					window.top.$('#dqm_dataestimatecal_addbaseform').form('submit', {
						url : '${pageContext.request.contextPath}/mininganalysis/dataEstimateCalAction!insertDataestimatecal.action',
						success : function(result) {
							try {
								var r = $.parseJSON(result);
								$.messager.show({
									title : '提示',
									msg : r.returnMsg
								});
								d.dialog('destroy');
								doQuery();//重新加载数据
							} catch (e) {
								window.top.$.messager.alert('提示', result);
								d.dialog('destroy');
							}
						}
					});
				}
			}],
			onClose : function() {
				window.top.$(this).dialog('destroy');
			}
		});
    }
    
    
	//修改
	function doEdit(estimateId)
	{
		window.top.$('<div id="dqm_accuracyruleconf_editdialog"/>').dialog({
			href:'${pageContext.request.contextPath}/mininganalysis/dataEstimateCalAction!querybeforeDataestimatecal.action?estimateId='+estimateId,
			top:($(window).height()-350)*0.5,
			left:($(window).width()-300)*0.5,
			width:660,
			modal:true,
			title:'修改',
			onClose:function(){
				$('#dqm_dataestimatecal_listtab').datagrid('reload');
				window.top.$(this).dialog('destroy');
				}
			});
	}
	
	//详细
	function doDetail(estimateId)
	{
		window.top.$('<div id="dqm_dataestimatecal_detaildialog"/>').dialog({
			href:'${pageContext.request.contextPath}/mininganalysis/dataEstimateCalAction!queryDataestimatecal.action?estimateId='+estimateId,
			top:($(window).height()-250)*0.5,
			left:($(window).width()-300)*0.5,
			width:660,
			modal:true,
			title:'指标评估与预测详细信息',
			buttons:[{
				text:'关 闭',
				iconCls:'',
				handler:function(){
					var d=window.top.$(this).closest('.window-body');
					d.dialog('destroy'); 
				}
			}],
			onClose:function(){
				window.top.$(this).dialog('destroy');
			}
		});
	}
	
	//删除
	function doDelete()
	{
		window.top.$.messager.confirm('删除确认', '确定要删除该条记录吗？', function(r){
			if (r){
					$('#dqm_dataestimatecal_searchform').form('submit',{
					url:'${pageContext.request.contextPath}/mininganalysis/dataEstimateCalAction!deleteDataestimatecal.action',
					success:function(result){
						try {
							var r = $.parseJSON(result);
							$.messager.show({
								title : '提示',
								msg : r.returnMsg
							});
							if (r.returnFlag) {
								$('#dqm_dataestimatecal_listtab').datagrid('reload');
							}
						} catch (e) {
							window.top.$.messager.alert('提示', result);
						}
					}
				});
			}
		});
	}

    //执行查询
    function doQuery(){
    	var kqiname=$('#dqm_dataestimatecal_kqiname').val();
    	var dataminimodelName=$('#dqm_dataestimatecal_dataminingmodel').combobox('getValue');
    	var estimator=$('#dqm_dataestimatecal_estimator').val();
    	var estimatestate=$('#dqm_dataestimatecal_estimatestate').combobox('getValue');
    	var query={kqiname:kqiname,dataminimodelName:dataminimodelName,estimator:estimator,estimatestate:estimatestate}; //把查询条件拼接成JSON
    	
    	$('#dqm_dataestimatecal_listtab').datagrid('options').queryParams=query; //把查询条件赋值给datagrid内部变量
    	$('#dqm_dataestimatecal_listtab').datagrid('reload'); //重新加载
    }
    //重置查询条件
    function doReset(){
    	$('#dqm_dataestimatecal_kqiname').val('');
    	$('#dqm_dataestimatecal_dataminingmodel').combobox('setValue','');
    	$('#dqm_dataestimatecal_estimator').val('');
    	$('#dqm_dataestimatecal_estimatestate').combobox('setValue','');
    }
    
    
    function doList(){
    	$('#dqm_dataestimatecal_listtab').datagrid({		
			url:'${pageContext.request.contextPath}/mininganalysis/dataEstimateCalAction!pageDataestimatecal.action',
			queryParams:serializeObject($('#dqm_dataestimatecal_searchform')),
			fit:true,
			border:false,
			fitColumns:true,
			pagination:true,
			striped:true,
			pageList:[10,20,30],
			singleSelect:false,
			pagePosition:'bottom',
			autoRowHeight:true,
			sortName:'estimateId',
			columns:[[  
			              {field:'estimateId',title:'选 择',width:20,align:'center',checkbox:true},
				          {field:'kqiid',title:'KQIID',width:10,align:'center',hidden:true},
				          {field:'kqiname',title:'指标名称',width:120,align:'left',sortable:true,formatter:function(value,rowData,rowIndex){
				        	 // return '<a title="'+rowData.kqiname+'" onclick="doDetail('+rowData.estimateId+')"  style="color:#398ece;cursor:pointer;" "text-overflow:ellipsis;" onmouseover="onMouseOverName(this)"  onmouseout="onMouseOutName(this)" >'+rowData.kqiname+'</a>';
				        	  return '<div  onmouseover="onMouseOverName(this)"  onmouseout="onMouseOutName(this)" onclick="doDetail('+rowData.estimateId+')" style="color:#2b76b7;cursor:pointer;width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;" title="'+rowData.kqiname+'">'+rowData.kqiname+'</div>'; 
 
				          }},
				          {field:'kqiversionnum',title:'指标版本号',width:10,align:'center',hidden:true},
				          {field:'dataminimodelName',title:'挖掘模型',width:180,align:'center',sortable:true},
				          {field:'dataminiFormula',title:'模型公式',align:'center',width:250},
				          {field:'estimator',title:'评估人',align:'center',width:50},
				          {field:'estimatetime',title:'评估时间',width:120,align:'center',sortable:true},
				          {field:'estimatestate',title:'评估状态',align:'center',width:50},				          
						{field:'dsafd',title:'操作',width:80,align:'left',formatter:function(value,rowData,rowIndex){
							return '<span  style="cursor:pointer" onclick="doEdit('+rowData.estimateId+')"><img  src="${pageContext.request.contextPath}/images/icons/modify_or_edit.png" title="修改" alt="修改" style="margin-top:2px;"/>修改&nbsp;&nbsp;</span>';
						}}
					]],
			toolbar:'#dqm_dataestimatecal_listtoobar'
	   });
    }
    $(document).ready(function(){
    	doList();//初始化表格数据
    	//查询按纽绑定事件
    	$('#btnQuery').bind('click',doQuery);
    	//重置按纽绑定事件
    	$('#btnReset').bind('click',doReset);
    	//挖掘模型名称
    	$('#dqm_dataestimatecal_dataminingmodel').combobox({  
    		url:'${pageContext.request.contextPath}/mininganalysis/dataEstimateCalAction!getAllDataminingModel.action',  
    		valueField:'dataminimodelName',
    		textField:'dataminimodelName',
    		required: false,
    		onLoadSuccess:function(){
    			//不让第一条为默认选择项
    			$('#dqm_dataestimatecal_dataminingmodel').combobox('unselect',0);
    		}
    	});
    });

</script>

<body class="easyui-layout">
<form id="dqm_dataestimatecal_searchform" method="post">
	<div data-options="region:'north'" style="height:80px;border-bottom:none;border-top:none;">
	<table border="0" cellpadding="0" cellspacing="0" height="100%"  width="100%" >
	        <tr>
	    		<td style="text-align:right;width:10%;" nowrap="nowrap">
	    			<label>指标名称：&nbsp;</label>
	    		</td>
				<td style="text-align:left;width:15%;" nowrap="nowrap">
    				<input id="dqm_dataestimatecal_kqiname" validType="specialCharFilter('dqm_dataestimatecal_kqiname')" type="text" name="kqiname" class="easyui-validatebox"></input> 
				</td>
				<td style="text-align:right;width:10%;" nowrap="nowrap">
					<label>挖掘模型：&nbsp;</label>	    
				</td>
				<td style="text-align:left;width:15%;" nowrap="nowrap">
    				<input id="dqm_dataestimatecal_dataminingmodel" class="easyui-combobox" name="dataminimodelName" panelHeight="auto" style="width:150px;"/>
				</td>
				<td style="text-align:right;width:10%;" nowrap="nowrap">
					<label>评估人：&nbsp;</label>
				</td>
				<td style="text-align:left;width:15%;" nowrap="nowrap">
    				<input id="dqm_dataestimatecal_estimator" validType="specialCharFilter('dqm_dataestimatecal_estimator')" type="text" name="estimator" class="easyui-validatebox" panelHeight="auto"/>
				</td>
				<td style="text-align:right;width:10%;" nowrap="nowrap">
					<label>评估状态：&nbsp;</label>
				</td>
				<td style="text-align:left;width:15%;padding-right:35px" nowrap="nowrap">
    				<select id="dqm_dataestimatecal_estimatestate" name="estimatestate" class="easyui-combobox" data-options="panelHeight:'auto',editable:false" style="width:150px;">  
						 <option value="" selected="selected">全部</option>
						 <option value=1>启用</option>  
					     <option value=0>不启用</option>  
				    </select>
				</td>
	        </tr>
	   		<tr>
	    		<td style="text-align:right;width:10%;" >
	    		</td>
				<td style="text-align:left;width:15%;" >
				</td>
				<td style="text-align:right;width:10%;" >
				</td>
				<td style="text-align:left;width:15%;" >
				</td>
				<td style="text-align:right;width:10%;" >
				</td>
				<td style="text-align:left;width:15%;" >
				</td>
				<td colspan="2" style="width:25%;text-align:right;" nowrap="nowrap" >	   
		    		<input type="button" id="btnQuery" onclick="doQuery()" value="查询" style="background-image: url('${pageContext.request.contextPath}/images/login/search.png');background-repeat: no-repeat;width:67px;height:23px;padding-left:12px;border:none;color:white;font-family:微软雅黑"/>	
				<input type="button" id="btnReset" onclick="doReset()" value="重置" style="background-image: url('${pageContext.request.contextPath}/images/login/reset.png');background-repeat: no-repeat;width:67px;height:23px;padding-left:12px;border:none;color:white;font-family:微软雅黑;margin-right:35px"/>			
	   			</td>
	   		</tr>
	    </table>
	</div>
	
	<div data-options="region:'center'" style="border-top:none">
		<table id="dqm_dataestimatecal_listtab"></table>		
		<div id="dqm_dataestimatecal_listtoobar" class="etl_panel_title">
			<a id="btnAdd" href="javascript:void(0);" onclick="doAdd()" class="easyui-linkbutton" data-options="iconCls:'icon-add',plain:true" style="float:left">新增</a>
			<div class="datagrid-btn-separator"></div>
			<a id="btnDelete" href="javascript:void(0);" onclick="doDelete()" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true">删除</a>
		</div>
    </div>
</form>
</body>
</html>
